﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using YSC_Core.BLL.Domain.BackstageModels;
using YSC_Services.BLL.Services.Interfaces;

namespace YSC_App_WebApi.Controllers
{
    /// <summary>
    /// 鱼市场后台接口
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class YSCBackstageController : ControllerBase
    {
        private IBasisBackstageServices _rep;
        //  public IUserServices _user;
        public YSCBackstageController(IBasisBackstageServices rep)
        {
            this._rep = rep;

        }

        /// <summary>
        /// 产地单位列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="sasearch"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetPlaceOfOriginUnitAll")]
        public ActionResult GetPlaceOfOriginUnitAll(int index, int size, string sasearch)
        {
            var ret = _rep.GetPlaceOfOriginUnitAll(index, size, sasearch);
            return Ok(ret);
        }

        /// <summary>
        /// 产地单位列表1
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="sasearch"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetPlaceOfOriginUnitXAll")]
        public ActionResult GetPlaceOfOriginUnitXAll(int index, int size, string sasearch)
        {
            var ret = _rep.GetPlaceOfOriginUnitXAll(index, size, sasearch);
            return Ok(ret);
        }

        /// <summary>
        /// 产地单位详情
        /// </summary>
        /// <param name="placeOfOId"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetPlaceOfOriginUnit")]
        public ActionResult GetPlaceOfOriginUnit(string placeOfOId)
        {
            var ret = _rep.GetPlaceOfOriginUnit(placeOfOId);
            return Ok(ret);
        }

        /// <summary>
        /// 新增修改产地单位
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("AddUpdatePlaceOfOriginUnit")]
        public ActionResult AddUpdatePlaceOfOriginUnit(PlaceOfOriginUnitModels model)
        {
            var ret = _rep.AddUpdatePlaceOfOriginUnit(model);
            return Ok(ret);
        }

        /// <summary>
        /// 产地单位删除
        /// </summary>
        /// <param name="placeOfOId"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("DelectPlaceOfOriginUnit")]
        public ActionResult DelectPlaceOfOriginUnit(string placeOfOId)
        {
            var ret = _rep.DelectPlaceOfOriginUnit(placeOfOId);
            return Ok(ret);
        }

        /// <summary>
        /// 市场单位列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="sasearch"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetMarketUnitAll")]
        public ActionResult GetMarketUnitAll(int index, int size, string sasearch)
        {
            var ret = _rep.GetMarketUnitAll(index, size, sasearch);
            return Ok(ret);
        }

        /// <summary>
        /// 市场单位详情
        /// </summary>
        /// <param name="GetMarketId"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetMarketUnit")]
        public ActionResult GetMarketUnit(string GetMarketId)
        {
            var ret = _rep.GetMarketUnit(GetMarketId);
            return Ok(ret);
        }

        /// <summary>
        /// 市场单位新增修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("AddUpdateMarketUnit")]
        public ActionResult AddUpdateMarketUnit(MarketUnitModels model)
        {
            var ret = _rep.AddUpdateMarketUnit(model);
            return Ok(ret);
        }

        /// <summary>
        /// 市场单位删除
        /// </summary>
        /// <param name="GetMarketId"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("DelectMarketUnit")]
        public ActionResult DelectMarketUnit(string GetMarketId)
        {
            var ret = _rep.DelectMarketUnit(GetMarketId);
            return Ok(ret);
        }


        /// <summary>
        /// 鱼种列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="status"></param>
        /// <param name="sasearch"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetFishSpeciesAll")]
        public ActionResult GetFishSpeciesAll(int index, int size, int status, string sasearch)
        {
            var ret = _rep.GetFishSpeciesAll(index, size, status, sasearch);
            return Ok(ret);
        }

        /// <summary>
        /// 鱼种详情
        /// </summary>
        /// <param name="fishId"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetFishSpecies")]
        public ActionResult GetFishSpecies(string fishId)
        {
            var ret = _rep.GetFishSpecies(fishId);
            return Ok(ret);
        }

        /// <summary>
        /// 鱼种详情
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("AddUpdateFishSpecies")]
        public ActionResult AddUpdateFishSpecies(FishSpeciesModel model)
        {
            var ret = _rep.AddUpdateFishSpecies(model);
            return Ok(ret);
        }

        /// <summary>
        /// 鱼种删除
        /// </summary>
        /// <param name="fishId"></param>
        /// <returns></returns>
        [HttpDelete]
        [Route("DelectFishSpecies")]
        public ActionResult DelectFishSpecies(string fishId)
        {
            var ret = _rep.DelectFishSpecies(fishId);
            return Ok(ret);
        }

        ///// <summary>
        ///// 用户列表
        ///// </summary>
        ///// <param name="index"></param>
        ///// <param name="size"></param>
        ///// <param name="status"></param>
        ///// <param name="sasearch"></param>
        ///// <returns></returns>
        //[HttpGet]
        //[Route("GetUserAll")]
        //public ActionResult GetUserAll(int index, int size, int status, string sasearch)
        //{
        //    var ret = _user.GetUserAll(index, size, status, sasearch);
        //    return Ok(ret);
        //}

        ///// <summary>
        ///// 用户详情
        ///// </summary>
        ///// <param name="userId"></param>
        ///// <returns></returns>
        //[HttpGet]
        //[Route("GetUser")]
        //public ActionResult GetUser(string userId)
        //{
        //    var ret = _user.GetUser(userId);
        //    return Ok(ret);
        //}

        ///// <summary>
        ///// 用户停用
        ///// </summary>
        ///// <param name="userId"></param>
        ///// <returns></returns>
        //[HttpDelete]
        //[Route("DelectUser")]
        //public ActionResult DelectUser(string userId)
        //{
        //    var ret = _user.DelectUser(userId);
        //    return Ok(ret);
        //}



        /// <summary>
        /// 鱼种年报表
        /// </summary>
        /// <param name="fishType"></param>
        /// <param name="province"></param>
        /// <param name="city"></param>
        /// <param name="dateYear"></param>
        /// <param name="unitType"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("FishSpeciesYearReport")]
        public ActionResult FishSpeciesYearReport(string fishType, string province, string city, string dateYear, int unitType)
        {
            var ret = _rep.FishSpeciesYearReport(fishType, province, city, dateYear, unitType);
            return Ok(ret);
        }

        /// <summary>
        /// 鱼种月报表
        /// </summary>
        /// <param name="dateYear"></param>
        /// <param name="fishName"></param>
        /// <param name="province"></param>
        /// <param name="city"></param>
        /// <param name="unitType"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("FishSpeciesMonthReport")]
        public ActionResult FishSpeciesMonthReport(string dateYear, string fishName, string province, string city, int unitType)
        {
            var ret = _rep.FishSpeciesMonthReport(dateYear, fishName, province, city, unitType);
            return Ok(ret);
        }

        /// <summary>
        /// 市场鱼价_走势报表
        /// </summary>
        /// <param name="fishName">鱼种</param>
        /// <param name="province">省份</param>
        /// <param name="city">城市</param>
        /// <param name="type">报表类型:0一周，1三月2一年</param>
        /// <returns></returns>          
        [HttpGet]
        [Route("GetMarketPriceTrendReport")]
        public ActionResult GetMarketPriceTrendReport(string fishName, string province, string city, int type)
        {
            var ret = _rep.GetMarketPriceTrendReport(fishName, province, city, type);
            return Ok(ret);
        }



        /// <summary>
        /// 塘口鱼价_走势报表
        /// </summary>
        /// <param name="fishName">鱼种</param>
        /// <param name="province">省份</param>
        /// <param name="city">城市</param>
        /// <param name="type">报表类型:0一周，1三月2一年</param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetPlaceOfOriginPriceTrendReport")]
        public ActionResult GetPlaceOfOriginPriceTrendReport(string fishName, string province, string city, int type)
        {
            var ret = _rep.GetPlaceOfOriginPriceTrendReport(fishName, province, city, type);
            return Ok(ret);
        }

        /// <summary>
        /// 鱼种
        /// </summary>
        /// <param name="fishType"></param>
        /// <returns>根据鱼种类别查询鱼种</returns>
        [HttpGet]
        [Route("GetFingerlingTypeAll")]      
        public ActionResult GetFingerlingTypeAll(string fishType)
        {
            var ret = _rep.GetFingerlingTypeAll(fishType);
            return Ok(ret);
        }

        /// <summary>
        ///  市场价格列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="areaName"></param>
        /// <param name="fishType"></param>
        /// <param name="fishName"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetMarketPriceAll")]
        public ActionResult GetMarketPriceAll(int index, int size, string areaName, string fishType, string fishName)
        {
            var ret = _rep.GetMarketPriceAll(index, size, areaName, fishType, fishName);
            return Ok(ret);
        }

        /// <summary>
        /// 塘口价格列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="areaName"></param>
        /// <param name="fishType"></param>
        /// <param name="fishName"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetPlaceOfOriginPriceAll")]
        public ActionResult GetPlaceOfOriginPriceAll(int index, int size, string areaName, string fishType, string fishName)
        {
            var ret = _rep.GetPlaceOfOriginPriceAll(index, size, areaName, fishType, fishName);
            return Ok(ret);
        }
    }
}